package be.vdab.servlets;

import java.io.IOException;
/*import java.util.Enumeration;
import java.util.LinkedHashMap;
import java.util.Map;*/
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import be.vdab.util.RequestStatistiek;

/**
 * Servlet implementation class HeadersServlet
 */
@WebServlet("/headers.htm")
public class HeadersServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	private static final String VIEW = "/WEB-INF/JSP/headers.jsp";
	private final RequestStatistiek requestStatistiek = new RequestStatistiek(); 
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		requestStatistiek.voegRequestToe(request);
		/*Map<String,String> headers=new LinkedHashMap<>();
	    Enumeration<String> headerNames = request.getHeaderNames();
	    while (headerNames.hasMoreElements()) { 
	        String headerName = headerNames.nextElement(); 
	        String headerValue = request.getHeader(headerName);
	        headers.put(headerName, headerValue);
       }
       request.setAttribute("headers", headers);*/
       RequestDispatcher dispatcher=request.getRequestDispatcher(VIEW);
       dispatcher.forward(request, response);
	}
}
